import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let router = new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      meta: {
        title: '首页'
      },
      component: resolve => require(['../components/Index'], resolve)
    }
  ]
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title ? to.meta.title : ''
  next()
})

export default router
